package com.itheima.d07_logback;


import lombok.extern.log4j.Log4j;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.function.Predicate;

/**
 *
 */
@Slf4j     // @Log4j
public class Test {
    //1.框架下载：三个
    //2.配置文件：logback.xml
    //3.使用：在需要日志记录的类中，定义记录日志的对象：Logger logger = LoggerFactory.getLogger(Test.class);
    static Logger logger = LoggerFactory.getLogger(Test.class);
    public static void chu(int a, int b) {
        //System.out.println("\t除法参数：" + a);
        log.info("\t除法参数：" + a);
        //System.out.println("\t除法参数：" + b);
        log.info("\t除法参数：" + b);
        int c = a / b;
        //System.out.println("\t除法结果：" + c);
        log.info("\t除法结果：" + c);
    }

    public static void main(String[] args) {

        try {
            //System.out.println("开始进行除法操作····");
            log.info("开始进行除法操作····");
            chu(10, 0);
            //System.out.println("结束进行除法操作····");
            log.info("结束进行除法操作····");
        } catch (Exception e) {
            //System.out.println("出现了异常，请稍后重试····");
            log.error("出现了异常，请稍后重试····");
            throw new RuntimeException(e);
        }

        JButton jButton = new JButton();



        //匿名内部类作用：设计类  + 创建对象
        jButton.addActionListener(e-> {
                System.out.println("点击了按钮");
                System.out.println("点击了按钮");
                System.out.println("点击了按钮");
                System.out.println("点击了按钮");
                System.out.println("点击了按钮");
                System.out.println("点击了按钮");
        });


        ArrayList<String> list = new ArrayList<>();
        list.stream()
                .filter(new Predicate<String>() {
                    @Override
                    public boolean test(String s) {
                        return false;
                    }
                }).sorted(new Comparator<String>() {
                    @Override
                    public int compare(String o1, String o2) {
                        return 0;
                    }
                });

    }




}
